package com.chinasoft.ssm.service.impl;

import com.chinasoft.ssm.mapper.OrderhisMapper;
import com.chinasoft.ssm.pojo.Orderhis;
import com.chinasoft.ssm.service.OrderhisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderhisServiceImpl implements OrderhisService {
    @Autowired
    OrderhisMapper mapper;

    @Override
    public List<Orderhis> select(Integer userId) {
        return mapper.findById(userId);
    }

    @Override
    public Integer insert(Orderhis bike) {
        return   mapper.insert(bike);
    }

    @Override
    public Integer update(Orderhis bike) {
        return mapper.update(bike);
    }

    @Override
    public Orderhis selectbyId(Integer id, Integer bikeid) {
        return mapper.findByBikeId(id,bikeid);
    }

    @Override
    public Orderhis selectById(Integer id) {
        return mapper.selectById(id);
    }

    @Override
    public Integer deleteById(Integer id) {
        return mapper.deleteById(id);
    }

    @Override
    public List<Orderhis> selectAll() {
        return mapper.getAll();
    }

    @Override
    public List<Orderhis> selectByDSql(Orderhis orderhis) {
        return mapper.selectByDSql(orderhis);
    }

    @Override
    public Integer add(Orderhis orderhis) {
        return mapper.add(orderhis);
    }
    @Override
    public Integer countTotalOrders() {
        return mapper.countTotalOrders();
    }

    @Override
    public Double sumTotalCosts() {
        return mapper.sumTotalCosts();
    }
}
